package org.action;

import java.util.List;

import org.bean.O2rankrank;
import org.bean.O2ranksongs;import org.service.CapableService;
import org.util.PageBean;

import com.opensymphony.xwork2.ActionSupport;

public class ActivePlayerAction extends ActionSupport{
	
	
	private CapableService capableservice;
	private PageBean pageBean;
	private  int page;
	private int rank;
	private int rankpage;
	
	@Override
	public String execute() throws Exception {
		// TODO Auto-generated method stub
		if(page==0)
		{
			page=1;
		}
		this.pageBean = capableservice.queryForPageActive(20, page);
		
		List<O2rankrank> list = pageBean.getList();
		
		for(int i = 0; i < list.size(); i++)
		{
			O2rankrank O2rankrank = list.get(i);
			rank = i+1;
			rankpage = page -1;
			
			if(page==1){
				
				O2rankrank.setRank(rank);
			}
			else{
				O2rankrank.setRank(rank + rankpage*20);
			}
			
		}
		
		
		
		return SUCCESS;
	}

	public CapableService getCapableservice() {
		return capableservice;
	}

	public void setCapableservice(CapableService capableservice) {
		this.capableservice = capableservice;
	}

	public PageBean getPageBean() {
		return pageBean;
	}

	public void setPageBean(PageBean pageBean) {
		this.pageBean = pageBean;
	}

	public int getPage() {
		return page;
	}

	public void setPage(int page) {
		this.page = page;
	}
	
	
	
	
	
	
	
}
